package DAO;

import entity.EmpManager;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;
import utils.Dbutils;

import java.sql.SQLException;

/**
 * @author lishunlin110
 * @version 1.0
 * @description: 管理员dao实现
 * @date 2021/8/26 10:48
 */
public class EmpManagerImpl implements EmpManagerDao{

    @Override
    public EmpManager query(String username) {
        QueryRunner queryRunner = new QueryRunner(Dbutils.getDateSource());
        String sql = "select* from empManager where username=?";
        try {
           return queryRunner.query(sql, new BeanHandler<>(EmpManager.class),username);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
